#include <stdio.h>
#include <string.h>
#include "include/sm3.h"
int main() {
	SM3_CTX SMC;
	ossl_sm3_init(&SMC);

	unsigned char Data[1024];
	unsigned char md[SM3_DIGEST_LENGTH] = { 0 };
	printf("输入数据: \n");
	scanf("%s",(char *)Data);
	printf("十六进制：\n");
	for (int i = 0; i < strlen((char*)Data); i++) {
		printf("0x%02x ", *(Data+i));
		if(i%8==7) printf("\n");
	}
	printf("\n");
	ossl_sm3_update(&SMC, Data, strlen((char*)Data));
	ossl_sm3_final(md, &SMC);
	printf("\nHash值：\n");
	for (int i = 0; i < SM3_DIGEST_LENGTH; i++) {
		printf("%02x", *(md + i));
		if (i % 4 == 3) {
			printf(" ");
		}
	}
	printf("\n");
	return 0;
}